<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*"%>
<%@ page import="xml.response.*"%>
<%@ page import="xml.root"%>
<%@ page import="util.print.printLogCat"%>
<%@ page import="org.sql.table.*"%>
<%@ page import="xml.var"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="jqgrid.jqgrid"%>
<%@ page import="requestInterFace.Handle.orderHandle"%>
<%@ include file="../../util/paramPrint.jsp" %>
<%@ page trimDirectiveWhitespaces="true" %> 
<%   

    /*********** jqgrid ******************/
		jqgrid jq=new jqgrid();
		jq.setRows(request.getParameter(jqgrid._rows));
		jq.setSord(request.getParameter(jqgrid._sord));
		jq.setSortname(request.getParameter(jqgrid._sortname));
		jq.setPage(request.getParameter(jqgrid._page));
		jq.setOper(request.getParameter(jqgrid._oper));
		jq.setSearch(request.getParameter(jqgrid._search));
		/*************************************/
	
		String Path_ID = request.getParameter("Path_ID");
		String Order_ID = request.getParameter("Order_ID");
		String User_ID = request.getParameter("User_ID");
		
		String userType=(String)session.getAttribute("User_Type");
		String userID=(String)session.getAttribute("User_ID");
			root root=new root();
		if(userType==null||userID==null||userID.equals("")||userType.equals("")){
		root.setStatus("false");
		root.setMsg("未登录");
		PrintWriter pw = response.getWriter();
		pw.println(root.getXmlString());
		pw.flush();
		return ;
		}
		
		if(Path_ID==null||Path_ID.equals("")){
		root.setStatus("false");
		root.setMsg("请输入路线ID");
		PrintWriter pw = response.getWriter();
		pw.println(root.getXmlString());
		pw.flush();
		return ;
		}

		deliverpathinfo1_1 user=new deliverpathinfo1_1();
		user.setResultField("Path_ID").setResultField("Order_ID").setResultField("Path_Addrs").setResultField("Distance").
		setResultField("Transport_Cost").setResultField("Info");
		if(Order_ID!=null&&(!Order_ID.equals(""))){
		 user.addequwhile("Order_ID"," = ",Order_ID);
		}
		
		if(userType!=null&&userType.equals("1")){
		//管理员
		if(User_ID!=null&&(!User_ID.equals(""))){
		 user.addequwhile("User_ID"," like ","%"+User_ID+"%");
		}
		//if(Path_ID!=null&&(!Path_ID.equals(""))){
		 //user.addequwhile("Path_ID"," like ","%"+Path_ID+"%");
		//}
		}else if(userType!=null&&userType.equals("4")){
		 user.addequwhile("User_ID"," = ",userID);
		// if(Path_ID!=null&&(!Path_ID.equals(""))){
		 //user.addequwhile("Path_ID"," like ","%"+Path_ID+"%");
		//}
		}else if(userType!=null&&userType.equals("3")){
		
		//if(Path_ID!=null&&(!Path_ID.equals(""))){
		
		//}
		}
		 user.addequwhile("Path_ID"," like ","%"+Path_ID+"%");
		user.setLimit((jq.getPageInt()-1)*jq.getRowsInt(), jq.getRowsInt());
		Vector d=user.getTableFactroy();
		root.setRecords(""+d.size());//设置当前查询到的记录数
		root.setMsg(Path_ID);
		int pageNum=user.getCount()/jq.getRowsInt();
		if((user.getCount()%jq.getRowsInt())>0){
			pageNum++;
		}
		root.setTotal_Count(""+pageNum);//查询到的总记录数
		root.setLimit_Offset(""+jq.getPage());//当前查询页面
		for(int i=0;i<d.size();i++){
			deliverpathinfo1_1 u=(deliverpathinfo1_1)d.elementAt(i);
		Enumeration e=u.getTable().elements();
		response res=new response();
		res.setAttribute_Id(""+i);
for(int j=0;j<u.getResultFieldNum();j++){
			String field=(String)u.getSql().getResultField().elementAt(j);
    		var v=(var)u.getTable().get(field);
    		res.put(v.getName(), v);
		}
		root.addResponse(res);
		}
		//printLogCat.printlnWriter(root.getXmlString());
		String rep=root.getXmlString();
%>
<%=rep%>


